<template>
	<view class="main">
		<view class="sys-lst v-box">
			<view class="sys-item poser" @click="NavUrlRd('./systemUser')">
				账号管理
				<view class="sys-poser">
					<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/right-jt.png"></image></label>
				</view>
			</view>
			<view class="sys-item poser" @click="NavUrlRd('./systemManagement')">
				权限管理
				<view class="sys-poser">
					<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/right-jt.png"></image></label>
				</view>
			</view>
			<!-- <view class="sys-item poser" @click="NavUrlRd('./systemVersionUpdate')">
				版本更新
				<view class="sys-poser dis-row">
					<text>v1.0</text>
					<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/right-jt.png"></image></label>
				</view>
			</view> -->
			<view class="sys-item poser">
				关于我们
				<view class="sys-poser">
					<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/right-jt.png"></image></label>
				</view>
			</view>
			<!-- <view class="sys-item poser" @click="clearStorage">
				缓存清理
				<view class="sys-poser dis-row">
					<text>{{storageSize}}MB</text>
					<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/right-jt.png"></image></label>
				</view>
			</view> -->
			<view class="sys-item poser" @click="NavUrlRd('./systemWarn')">
				消息通知
				<view class="sys-poser">
					<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/right-jt.png"></image></label>
				</view>
			</view>
			<view class="sys-item poser" @click="NavUrlRd('./systemIndividualization')">
				个性化推荐
				<view class="sys-poser">
					<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/right-jt.png"></image></label>
				</view>
			</view>
			<view class="sys-item poser" @click="NavUrlRd('./systemPrivacy')">
				隐私设置
				<view class="sys-poser">
					<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/right-jt.png"></image></label>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import Index from "@/common/index-model.js"
let index = new Index()
let that = null	
export default {
	data() {
		return {
			storageSize:0
		}
	},
	methods: {
		NavUrlRd(url) {
			index.navigate_to(url)
		},
		getStorageSize(){
			let that = this;
			uni.getStorageInfo({
				success(res) {
					let size = res.currentSize;
					if (size < 1024) {
						that.storageSize = size + ' B';
					} else if (size/1024>=1 && size/1024/1024<1) {
						that.storageSize = Math.floor(size/1024*100)/100 + ' KB';
					} else if (size/1024/1024>=1) {
						that.storageSize = Math.floor(size/1024/1024*100)/100 + ' M';
					}
				}
			})
		},
		// 清理缓存
		clearStorage (){
			let that = this;
			uni.showModal({
				title:'提示',
				content:'确定清除缓存吗?',
				confirmText:'立即清除',
				success(res) {
					if(res.confirm){
						uni.clearStorageSync();
						//重新获取并显示清除后的缓存大小
						that.getStorageSize();
						uni.showToast({
							title:'清除成功'
						})
					}
				}
			})
		}
	}
}	
</script>

<style>
@import url("@/static/css/publics.css");
@import url("@/static/css/systemSet.css");	
</style>